package com.ld.security.demo.job;

import com.ld.security.common.core.util.SpringUtil;
import com.ld.security.common.quartz.modules.job.job.SuperJob;
import com.ld.security.server.user.modules.rec.service.IRecCardService;
import com.ld.security.server.user.modules.ups.entity.UpsUserEntity;
import com.ld.security.server.user.modules.ups.service.IUpsUserService;
import org.quartz.JobExecutionContext;

import java.util.List;
import java.util.stream.Collectors;


/**
 * 内容推荐任务
 */
public class RecContentJob extends SuperJob {


    @Override
    public void run(JobExecutionContext jobExecutionContext) {
        IUpsUserService iUpsUserService =   SpringUtil.getBean(IUpsUserService.class);
        IRecCardService iRecCardService =   SpringUtil.getBean(IRecCardService.class);


        List<UpsUserEntity> users =  iUpsUserService.all();
        List<String> ids =  users.stream().map(v -> {
          return v.getId() ;
        }).collect(Collectors.toList());


        iRecCardService.runUserRecommend(ids);
    }
}
